﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OtherArticle.ascx.cs"
    Inherits="Framework.Portal.Layouts.Client.Modules.User.OtherArticle" %>
<div class="col2">
<br class="clear" />
<ul class="list_pro duthikhac">
    <li style="border-bottom: none; border-top: 1px solid #c3c3c3; color: #2e2e2e; text-transform: uppercase;
        font-weight: bold;">
        <%= MENUNAME %></li>
    <asp:Repeater ID="rptContent" runat="server" OnItemDataBound="rptContent_ItemDataBound">
        <ItemTemplate>
            <li>
                <div style="min-height: 70px">
                    <span class="ava1"><a href="#" class="play">play</a><asp:Image ID="imgAvatar" BorderWidth="1"
                        Width="80" Height="65" runat="server" ImageUrl="/Uploads/117/1/PreAvatar/ava3.jpg" /></span>
                    <asp:HyperLink ID="hplTitle" runat="server" CssClass="title_a"></asp:HyperLink><br />
                    <span class="view">Lượt nghe:
                        <span id="boxView_<%# Eval("CONTENT_ID") %>"></span>
                        | <span id="boxLike_<%# Eval("CONTENT_ID") %>"></span> người thích </span>
                    <br />
                    <p>
                        <asp:Literal ID="lblTeaser" runat="server"></asp:Literal></p>
                </div>
                <small class="time com_like">
                    <asp:Literal ID="lblCreateDate" runat="server"></asp:Literal>
                    <asp:HyperLink ID="hplComment" runat="server" style="margin:0 0 0 10px">Bình luận</asp:HyperLink> <span id="baikhac_box_<%# Eval("CONTENT_ID") %>"><span class="dot">·</span> <a href="javascript:;" onclick="DoVote(<%# Eval("CONTENT_ID") %>, 'baikhac_box_<%# Eval("CONTENT_ID") %>')">Thích</a></span></small> </li>
        </ItemTemplate>
        <AlternatingItemTemplate>
            <li>
                <div style="min-height: 70px">
                    <span class="ava1"><a href="#" class="play">play</a><asp:Image ID="imgAvatar" BorderWidth="1"
                        Width="80" Height="65" runat="server" ImageUrl="/Uploads/117/1/PreAvatar/ava3.jpg" /></span>
                    <asp:HyperLink ID="hplTitle" runat="server" CssClass="title_a"></asp:HyperLink><br />
                    <span class="view">Lượt nghe:
                        <span id="boxView_<%# Eval("CONTENT_ID") %>"></span>
                        | <span id="boxLike_<%# Eval("CONTENT_ID") %>"></span> người thích </span>
                    <br />
                    <p>
                        <asp:Literal ID="lblTeaser" runat="server"></asp:Literal></p>
                </div>
                <small class="time com_like">
                    <asp:Literal ID="lblCreateDate" runat="server"></asp:Literal>
                    <asp:HyperLink ID="hplComment" runat="server" style="margin:0 0 0 10px">Bình luận</asp:HyperLink> <span id="baikhac_box_<%# Eval("CONTENT_ID") %>"><span class="dot">·</span> <a href="javascript:;" onclick="DoVote(<%# Eval("CONTENT_ID") %>, 'baikhac_box_<%# Eval("CONTENT_ID") %>')">Thích</a></span></small> </li>
        </AlternatingItemTemplate>
    </asp:Repeater>
</ul>
<!--end:bai du thi khac -->
</div>
<script type="text/javascript">
    var arrayArticle = <%= arrayArticle %>;
    $(document).ready(function () {        
         $.each(arrayArticle, function(index, value) { 
            $.ajax({
                type: "POST",
                cache: false,
                url: "Resources.ashx?module=contribution&action=getview",
                data: { "articleId": value},
                success: function (html) {
                    $("#boxView_" + value).html(html);
                },
                timeout: 5000,
                complete: function () {  

                 }
            });
            var dataOtherResponse;
            $.ajax({
                type: "POST",
                cache: false,
                url: "Resources.ashx?module=contribution&action=getcontribution",
                data: { "articleId": value},
                success: function (html) {
                    dataOtherResponse = html;
                    $("#boxLike_" + value).html(html.Likes.length);
                },
                timeout: 5000,
                complete: function () {    
                    var isMe = -1;
                    if(curentUser > 0)
                    {
                        $.each(dataOtherResponse.Likes, function(index, value) { 
                            if(value.USERID == curentUser){
                                isMe = index;
                            }
                        });
                        if(isMe >= 0)
                            $("#baikhac_box_" + value).hide(); 
                    }
                    else
                        $("#baikhac_box_" + value).hide(); 
                }
            });
        });        
    });
</script>